package com.yehuishou.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yehuishou.dao.NewsDao;
import com.yehuishou.pojo.News;
import com.yehuishou.pojo.NewsParameter;
import com.yehuishou.service.NewsService;

@Service
public class NewsServiceImpl implements NewsService {
	@Resource
	private NewsDao newsdao;

	@Override
	public PageInfo<News> newssel(Integer pageNum, Integer pageSize, NewsParameter np) {
		PageHelper.startPage(pageNum, pageSize);
		// TODO Auto-generated method stub
		List<News> list = newsdao.newssel(np);
		PageInfo<News> pageinfo = new PageInfo<News>(list);
		return pageinfo;
	}

	@Override
	public int newsadd(News news) {
		// TODO Auto-generated method stub
		int i = newsdao.newsadd(news);
		return i;
	}

	@Override
	public int newsdele(Integer nid) {
		// TODO Auto-generated method stub
		int i = newsdao.newsdele(nid);
		return i;
	}

	@Override
	public List<News> newsupdatetz(Integer nid) {
		// TODO Auto-generated method stub
		List<News> list = newsdao.newsupdatetz(nid);
		return list;
	}

	@Override
	public int newsupdate(News news) {
		// TODO Auto-generated method stub
		int i = newsdao.newsupdate(news);
		return i;
	}
}
